<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>热销商品</title>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link href="main.css" rel="stylesheet" type="text/css" />
<script src="../script/jquery-1.4.4.min.js" type=text/javascript></script>
</head>
<body>
<div class="bigbox">
  <div class="bigboxhead">推荐商品</div>
  <div class="bigboxbody">
    <form name="sysconfig" action="" method="post">
    <input type="hidden" name="tag_id" value="<{$smarty.get.editid}>">
      <table width="100%" cellspacing="0">
        <tr class="theader">
          <td height="23" colspan="4" >推荐商品设置</td>
          <td height="23">标签：<{$tag_name}></td>
        </tr>
        <tr>
          <td align="left">推荐商品</td>
          <td colspan="3" align="left" ><input class="text" name="index_best" type="text" id="index_best" value="<{$info_ids}>" />
            <span class="bz">填写产品ID号，用,号分隔。如：　1,2,3</span></td>
        </tr>
        <tr>
        <td colspan="3" id="index_best_span" style="display:none;">
        </td>
        </tr>
        
        <tr>
        <td colspan="3" id="index_hot_span" style="display:none;">
        
        
        </td>
        </tr>
        <tr>
        
          <td width="17%" height="40" align="right">&nbsp;</td>
          <td colspan="3" align="left" ><input  class="btn" type="submit" name="submit" value="提交"></td>
        </tr>
      </table>
    </form>
  </div>
</div>
<script>
$('input[id^=index]').bind('click change',function(){
    var $$=$(this);
    //alert($$.val());

    if(!$$.val()){return false;}


    if(/[^\d,]/.test($$.val())){

        alert('id请使用半角,分隔');
        return false;

    }

    $.getJSON('?m=product&s=product_tags_floor.php&act=recpro&type='+$$.attr('id')+'&tag_id=<{$smarty.get.editid}>&info_ids='+$$.val(),function(data){
            var str='<table width="100%" class="alc"><tbody><tr><th width="100" align="left">产品图</th><th width="350">产品名称</th><th width="200" align="left">短标题</th><th width="100">排序</th></tr>';
                $.each(data,function(k,v){
                    str+='<tr><td><img width="50" src="'+v.pic+'"></td>';
                    str+='<td class="al"><input type="hidden" name="'+$$.attr('id')+'_id[]" value="'+v.id+'"><div class="name">'+v.pname+'</div></td>';
                  str+='<td><div class="name"><input type="text" value="'+(v.product_title==null?'':v.product_title)+'" name="'+$$.attr('id')+'_title[]"/></div></td>';
                  str+='<td align="center"><input type="text" style="width:30px;" name="'+$$.attr('id')+'_displayorder[]" value="'+(v.displayorder?v.displayorder:k+1)+'"></td>';
                    });
              
       str+='</tbody></table>';

       $('#'+$$.attr('id')+'_span').html(str).show();


        



        })


    
})



</script>
</body>
</html>